package cmd

import (
	"errors"
	"fmt"
	"os"

	"github.com/spf13/cobra"
)

var (
	vers         bool
	ossProvider  string
	aliAccessKey string
	aliSecretKey string
	endPoint     string
)

var rootCmd = &cobra.Command{
	Use:   "cloud-station-cli",
	Short: "cloud-station-cli 文件中转服务",
	Long:  "cloud-station-cli ...",
	RunE: func(cmd *cobra.Command, args []string) error {
		if vers {
			fmt.Println("0.0.1")
			return nil
		}
		return errors.New("no flags find")
	},
}

func Execute() {
	if err := rootCmd.Execute(); err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
}

func init() {
	rootCmd.PersistentFlags().StringVarP(&ossProvider, "oss_provider", "p", "aliyun", "the oss provider [aliyun/qcloud]")
	rootCmd.PersistentFlags().StringVarP(&endPoint, "endpoint", "e", "", "上传的endpoint")
	// rootCmd.PersistentFlags().StringVarP(&aliAccessKey, "ali_access_id", "i", "xxx", "the ali oss access id")
	// rootCmd.PersistentFlags().StringVarP(&aliSecretKey, "ali_secret_key", "s", "", "the ali oss access key")
	rootCmd.PersistentFlags().BoolVarP(&vers, "version", "v", false, "the cloud-station-cli version")
}
